<template>
  <div class="assessment-complete-container">
    <!-- 主要内容区域 -->
    <div class="main-content">
      <!-- 成功图标和标题 -->
      <div class="success-section">
        <div class="success-icon">
          <i class="el-icon-success"></i>
        </div>
        <h2 class="success-title">测评完成</h2>
      </div>

      <!-- 感谢内容 -->
      <div class="thank-you-section">
        <div class="thank-you-card">
          <h3 class="thank-you-title">恭喜你完成了一次深入的自我探索！</h3>
          <p class="thank-you-text">
            感谢你的真诚和勇敢，每一个回答都是你内心世界的一抹独特色彩，都非常有价值。
          </p>
        </div>
      </div>

      <!-- 支持信息 -->
      <div class="support-section">
        <div class="support-card">
          <h3 class="support-title">
            <i class="el-icon-heart"></i>
            我们在这里支持你：
          </h3>
          <p class="support-intro">
            如果你有任何想聊聊的事情，或是对今天的问卷有任何疑问，都非常欢迎你：
          </p>
          
          <!-- 支持选项 -->
          <div class="support-options">
            <div class="support-option">
              <div class="option-icon">
                <i class="el-icon-user"></i>
              </div>
              <div class="option-content">
                <h4>预约心理老师</h4>
                <p>心理辅导室的大门永远为你敞开。</p>
                <el-button type="primary" @click="bookCounselor">立即预约</el-button>
              </div>
            </div>
            
            <div class="support-option">
              <div class="option-icon">
                <i class="el-icon-phone"></i>
              </div>
              <div class="option-content">
                <h4>寻求即时帮助</h4>
                <p>如果你或你的朋友需要立即倾诉，可以拨打心理援助热线。</p>
                <div class="hotline-info">
                  <span>全国青少年心理服务热线：</span>
                  <strong>12355</strong>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 祝福语 -->
      <div class="blessing-section">
        <div class="blessing-card">
          <div class="blessing-icon">
            <i class="el-icon-sunny"></i>
          </div>
          <p class="blessing-text">
            最后，愿你的创意永远自由，心灵始终充满阳光。
          </p>
        </div>
      </div>

      <!-- 操作按钮 -->
      <div class="action-section">
        <el-button type="primary" size="large" @click="goToHome">
          <i class="el-icon-house"></i>
          返回首页
        </el-button>
        <!-- <el-button type="default" size="large" @click="viewResults">
          <i class="el-icon-document"></i>
          查看测评结果
        </el-button> -->
      </div>
    </div>

    <!-- 装饰元素 -->
    <div class="decoration">
      <div class="star star-1"></div>
      <div class="star star-2"></div>
      <div class="star star-3"></div>
      <div class="star star-4"></div>
      <div class="star star-5"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AssessmentComplete',
  data() {
    return {
      taskInfo: {
        id: '',
        scaleId: '',
        taskName: ''
      }
    }
  },
  
  mounted() {
    // 获取路由参数
    this.taskInfo.id = this.$route.query.id || ''
    this.taskInfo.scaleId = this.$route.query.scaleId || ''
    this.taskInfo.taskName = this.$route.query.taskName || ''
    
    console.log('测评完成页面初始化，任务信息:', this.taskInfo)
  },
  
  methods: {
    // 预约心理老师
    bookCounselor() {
      this.$message.info('预约功能开发中，请联系心理辅导室')
      // TODO: 实现预约功能
    },
    
    // 返回首页
    goToHome() {
      this.$router.push('/')
    },
    
    // 查看测评结果
    viewResults() {
      if (!this.taskInfo.id || !this.taskInfo.scaleId) {
        this.$message.error('测评信息不完整，无法查看结果')
        return
      }
      
      // 跳转到结果页面
      window.open(`/questionnaire?scaleId=${this.taskInfo.scaleId}&taskId=${this.taskInfo.id}&viewType=result`)
    }
  }
}
</script>

<style scoped>
.assessment-complete-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.main-content {
  max-width: 800px;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
  animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 成功区域 */
.success-section {
  text-align: center;
  margin-bottom: 30px;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #67c23a, #85ce61);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(103, 194, 58, 0.4);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 20px rgba(103, 194, 58, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(103, 194, 58, 0);
  }
}

.success-icon i {
  font-size: 40px;
  color: white;
}

.success-title {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 感谢区域 */
.thank-you-section {
  margin-bottom: 30px;
}

.thank-you-card {
  background: linear-gradient(135deg, #fff5f5, #fef5e7);
  border-radius: 15px;
  padding: 25px;
  border-left: 5px solid #f56c6c;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.thank-you-title {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 15px 0;
}

.thank-you-text {
  font-size: 16px;
  color: #606266;
  line-height: 1.6;
  margin: 0;
}

/* 支持区域 */
.support-section {
  margin-bottom: 30px;
}

.support-card {
  background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
  border-radius: 15px;
  padding: 25px;
  border-left: 5px solid #409eff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.support-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 10px 0;
  display: flex;
  align-items: center;
}

.support-title i {
  margin-right: 8px;
  color: #f56c6c;
}

.support-intro {
  font-size: 16px;
  color: #606266;
  margin-bottom: 20px;
}

.support-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.support-option {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.support-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.option-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #409eff, #36a3f7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-icon i {
  font-size: 24px;
  color: white;
}

.option-content {
  flex: 1;
}

.option-content h4 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 8px 0;
}

.option-content p {
  font-size: 14px;
  color: #606266;
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.hotline-info {
  margin-top: 8px;
  font-size: 14px;
  color: #606266;
}

.hotline-info strong {
  color: #f56c6c;
  font-size: 18px;
  font-weight: 700;
}

/* 祝福区域 */
.blessing-section {
  margin-bottom: 30px;
}

.blessing-card {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border-radius: 15px;
  padding: 25px;
  text-align: center;
  border-left: 5px solid #e6a23c;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.blessing-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e6a23c, #f7ba2a);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
}

.blessing-icon i {
  font-size: 30px;
  color: white;
}

.blessing-text {
  font-size: 16px;
  color: #2c3e50;
  font-weight: 500;
  margin: 0;
  line-height: 1.6;
}

/* 操作区域 */
.action-section {
  text-align: center;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-section .el-button {
  min-width: 140px;
  height: 45px;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.action-section .el-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 装饰元素 */
.decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: twinkle 3s infinite;
}

.star-1 {
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.star-2 {
  top: 40%;
  right: 15%;
  animation-delay: 1s;
}

.star-3 {
  top: 60%;
  left: 20%;
  animation-delay: 2s;
}

.star-4 {
  bottom: 30%;
  right: 10%;
  animation-delay: 0.5s;
}

.star-5 {
  bottom: 20%;
  left: 30%;
  animation-delay: 1.5s;
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    padding: 30px 20px;
    margin: 10px;
  }
  
  .support-options {
    grid-template-columns: 1fr;
  }
  
  .action-section {
    flex-direction: column;
    align-items: center;
  }
  
  .action-section .el-button {
    width: 100%;
    max-width: 200px;
  }
  
  .success-title {
    font-size: 24px;
  }
  
  .thank-you-title {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 25px 15px;
  }
  
  .success-icon {
    width: 60px;
    height: 60px;
  }
  
  .success-icon i {
    font-size: 30px;
  }
  
  .success-title {
    font-size: 20px;
  }
}
</style>